home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / mmulib / fixes / consolefix.readme < prev    next >
Text File  |  1999-11-29  |  3KB  |  95 lines

  1. Short:    Fix a bug in the console.device
  2. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  3. Author:   thor@math.tu-berlin.de (Thomas Richter)
  4. Type:     util/boot
  5. Version:  1.01
  6. Requires: Os 3.0 (V39) or better
  7.  
  8. _____________________________________________________________________________
  9.  
  10. Changes made in release 1.01:
  11.  
  12. -ConsoleFix 1.00 failed from time to time if the console.device main task was, 
  13. due to some unfortune, not waiting in its main loop. Added a workaround
  14. that checks several times.
  15.  
  16. -Added a version tag.
  17. _____________________________________________________________________________
  18.  
  19.  
  20. Purpose of this program:
  21.  
  22. This little patch fixes possible crashes of the console.device task, which,
  23. luckely, do not show up under "normal" circumstances. However, as soon as
  24. the console.device supervisor task takes more stack than usual, or this
  25. stack is filled by more than just zeros, the console device will crash on
  26. window resizes.
  27.  
  28. The reason for this crash is that the console.device main task uses a
  29. faulty algorithm to traverse an exec style list: The list header is
  30. also processed as a "node". Due to some lucky coincidences, the only data
  31. that gets querried by this faulty node is on the stack of the console device,
  32. and again due to some coincidence, this points to an area of the stack which
  33. is usually set to zero. All provided the stack of the console.device doesn't 
  34. grow too much.
  35.  
  36. For the experts: 
  37.  
  38.     The main loop of the console device looks like this:
  39.  
  40.     lea WindowList(a6),a2        ;get the head of the window list
  41. .loop:
  42.     bsr ProcessWindow        ;re-calcutes the window on a resize
  43.  
  44.     move.l (a2),a2            ;get next node
  45.     tst.l (a2)            ;end of list?
  46.     bne.s .loop
  47.  
  48. Hence, the list header is processed as a first node. Urgh!
  49.  
  50.  
  51. The correct method would have been:
  52.  
  53.  
  54.     lea WindowList(a6),a2        ;get the head of the window list
  55.     bra.s .into
  56. .loop:
  57.     bsr ProcessWindow        ;re-calcutes the window on a resize
  58. .into:
  59.     move.l (a2),a2            ;get next node
  60.     tst.l (a2)            ;end of list?
  61.     bne.s .loop
  62.  
  63.  
  64. This program fixes this bug by "hacking in" a new main loop for the console
  65. device, the source code is included.
  66.  
  67. I'm sorry for the uglyness of this patch, it was designed at 2 a.m. in the
  68. night and I was all than awake. It currently works like it is, but I'd really
  69. prefer if someone could write a "nicer" fix, or if AI would include this fix
  70. in the "SetPatch" program.
  71.  
  72. _____________________________________________________________________________
  73.  
  74. Credits:
  75.  
  76. Thanks goes to Nils Goers and his StackSnoop program. This console.device
  77. problem showed up while Nils was beta-testing his program, and I was
  78. curious what could have caused the crash. Stack-Snoop fills the application
  79. stack with a "magic cookie" to find out the true stack size a program re-
  80. quires, and this magic cookie caused the buggy code above to get mad.
  81. Always interested in the true reason for a crash, I found the above bug...
  82.  
  83. _____________________________________________________________________________
  84.  
  85. Copyright:
  86.  
  87.     None, this is freeware, public domain. Do whatever you want to do
  88.     with it.
  89.  
  90. _____________________________________________________________________________
  91.  
  92.  
  93. Thomas,
  94.     January 1999
  95.